import Request from '@/libs/request'
import qs from 'qs'

/**上传说明书 */
export const mUploadInstructionBook = (data: FormData) =>
  Request.post<ProductFile.DataSource<'0045'>>(
    '/mg/mUploadInstructionBook',
    data
  )

/**上传操作视频 */
export const mUploadInstructionVideo = (data: FormData) =>
  Request.post<ProductFile.DataSource<'0046'>>(
    '/mg/mUploadInstructionVideo',
    data
  )

/**上传产品类型图片 */
export const mUploadProductTypeImage = (data: FormData) =>
  Request.post<ProductFile.DataSource<'0047'>>(
    '/mg/mUploadProductTypeImage',
    data
  )

/**下载说明书 */
export const mDownInstructionBook = (data: {fileName: FileName}) =>
  Request.filePost('/user/uDownInstructionBook', qs.stringify(data), {
    responseType: 'blob',
  })

/**添加产品资料 */
export const mAddProductFile = (data: ProductFile.AddDataSource) =>
  Request.get<null>('/mg/mAddProductFile', data)

/**查询产品资料 */
export const mSelectProductFileByPage = (
  data: Paging & {
    fileTypeCode: FileTypeCode
    fileName: FileName
  }
) =>
  Request.get<PagingResponse<ProductFile.DataSource>>(
    '/mg/mSelectProductFileByPage',
    data
  )
